//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Query Application Block
//===============================================================================

using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Unity;
using EntLibContrib.Query.Configuration.Unity;
using EntLibContrib.Query.Parameters;

namespace EntLibContrib.Query.Configuration
{
	/// <summary>
	/// Type to hold the elements of a single query parameter
	/// </summary>
	[Assembler(typeof(XmlParameterAssembler))]
	[ContainerPolicyCreator(typeof(XmlParameterPolicyCreator))]
	public class XmlParameterData : ParameterData
	{
		#region Fields
		private const string namespaceProperty = "namespace";
		#endregion

		#region Properties
		/// <summary>
		/// Gets or sets the type of the parameter.
		/// </summary>
		/// <value>The type of the parameter.</value>
		[ConfigurationProperty(namespaceProperty, IsRequired = false)]
		public string Namespace
		{
			get { return (string)base[namespaceProperty]; }
			set { base[namespaceProperty] = value; }
		}
		#endregion

		#region Construction
		/// <summary>
		/// Initializes a new instance of the <see cref="XmlParameterData"/> class.
		/// </summary>
		public XmlParameterData()
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="XmlParameterData"/> class.
		/// </summary>
		/// <param name="name">The parameter name.</param>
		/// <param name="namespaceName">Name of the namespace.</param>
		public XmlParameterData(string name, string namespaceName)
			: base(name, typeof(XmlParameter))
		{
			this.Namespace = namespaceName;
		}
		#endregion
	}
}
